using Microsoft.Expression.Drawing.Core;
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
namespace Microsoft.Expression.Controls
{
	internal class LineStrategy : ShapeStrategy
	{
		private Line sourceLine;
		private static readonly DependencyProperty X1ListenerProperty = DependencyProperty.Register("X1Listener", typeof(double), typeof(LineStrategy), new PropertyMetadata(new PropertyChangedCallback(GeometryStrategy.LayoutPropertyChanged)));
		private static readonly DependencyProperty X2ListenerProperty = DependencyProperty.Register("X2Listener", typeof(double), typeof(LineStrategy), new PropertyMetadata(new PropertyChangedCallback(GeometryStrategy.LayoutPropertyChanged)));
		private static readonly DependencyProperty Y1ListenerProperty = DependencyProperty.Register("Y1Listener", typeof(double), typeof(LineStrategy), new PropertyMetadata(new PropertyChangedCallback(GeometryStrategy.LayoutPropertyChanged)));
		private static readonly DependencyProperty Y2ListenerProperty = DependencyProperty.Register("Y2Listener", typeof(double), typeof(LineStrategy), new PropertyMetadata(new PropertyChangedCallback(GeometryStrategy.LayoutPropertyChanged)));
		private double X1Listener
		{
			get
			{
				return (double)base.GetValue(LineStrategy.X1ListenerProperty);
			}
			set
			{
				base.SetValue(LineStrategy.X1ListenerProperty, value);
			}
		}
		private double X2Listener
		{
			get
			{
				return (double)base.GetValue(LineStrategy.X2ListenerProperty);
			}
			set
			{
				base.SetValue(LineStrategy.X2ListenerProperty, value);
			}
		}
		private double Y1Listener
		{
			get
			{
				return (double)base.GetValue(LineStrategy.Y1ListenerProperty);
			}
			set
			{
				base.SetValue(LineStrategy.Y1ListenerProperty, value);
			}
		}
		private double Y2Listener
		{
			get
			{
				return (double)base.GetValue(LineStrategy.Y2ListenerProperty);
			}
			set
			{
				base.SetValue(LineStrategy.Y2ListenerProperty, value);
			}
		}
		public LineStrategy(LayoutPath layoutPath) : base(layoutPath)
		{
			this.sourceLine = (Line)layoutPath.SourceElement;
			base.SetListenerBinding(LineStrategy.X1ListenerProperty, "X1");
			base.SetListenerBinding(LineStrategy.X2ListenerProperty, "X2");
			base.SetListenerBinding(LineStrategy.Y1ListenerProperty, "Y1");
			base.SetListenerBinding(LineStrategy.Y2ListenerProperty, "Y2");
		}
		protected override PathGeometry UpdateGeometry()
		{
			LineGeometry lineGeometry = new LineGeometry();
			lineGeometry.set_StartPoint(new Point(this.sourceLine.get_X1(), this.sourceLine.get_Y1()));
			lineGeometry.set_EndPoint(new Point(this.sourceLine.get_X2(), this.sourceLine.get_Y2()));
			return lineGeometry.AsPathGeometry();
		}
	}
}
